<template>
	<view class="receipt-info">
		<view class="info-content">
			<view class="b-info">
				<!-- 供应商 -->
				<purchaseTitle
					:title="pageTitle"
					:supplier_info="supplierInfo" 
					:showArrow="showSettlement"
					:switchTxt="switchTxt" 
					:seeSupp="seeSupp"
					:isShowName="isShowName"
					:isShowCp="isShowCp"
					:orderType="orderType"
					@back="backCart"
					@addSupp="addSupp"
					@showSuppInfo="showSuppInfo"
					@swichTypeHandler="swichTypeHandler">
				</purchaseTitle>
				
				<!-- 开单 -->
				<view class="overflow-box" 
					:style="{height : `calc(100vh - ${boxHeight}px)`}" 
					v-show="cartList.length > 0 && showSettlement == -1">
					<purchaseCart ref="purchaseCart" 
						:list="cartList"
						:limitChangePrice="limitChangePrice"
						@editCartInfo="editCartInfo"
						@saveCart="saveCart">
					</purchaseCart>
				</view>
				
				<!-- 结算-->
				<view class="overflow-box"
					:style="{height : `calc(100vh - ${boxHeight}px)`}" 
					v-show="showSettlement != -1">
						<purchaseSettlement ref="settlement" 
						    :isHasYunPrint="isHasYunPrint"
						    :orderType="orderType"
							:supplierInfo="supplierInfo" 
							:setSellData="setSellData" 
							:limitBillChangeManger="limitBillChangeManger"
							:limitBillChangeTime="limitBillChangeTime"
							@finishOrderBack="finishOrderBack">
						</purchaseSettlement>
				</view>
				
				<!-- 编辑工具按钮 -->
				<purchaseBottomTabbar  v-if="cartList.length > 0"
					class="bttom-btn-box"
					:number="tabTotal.number"
					:showSettlement="showSettlement"
					:totalPrice="tabTotal.totalPrice" 
					:amountOrderPrice="tabTotal.amountOrderPrice"
					:discount="tabTotal.discount"
					:preferential="tabTotal.preferential"
					:netReceiVal="tabTotal.netReceiVal"
					:payTypeTxt="tabTotal.payTypeTxt"
					:limitChangePrice="limitChangePrice"
					:limitBillChangeTime="limitBillChangeTime"
					@optionAct="optionAct">
				</purchaseBottomTabbar>
				 
				<empty :style="'height:'+emptyHight + 'px'"
					@emptyAct="emptyAct" 
					:isReceipt="true" 
					v-if="cartList.length == 0 && showSettlement == -1"></empty>
			</view>
			
			<!-- 供应商 -->
			<view class="c-info" v-show="type == 1 && showInfo">
				<purchaseSupplyInfo ref="purchSuppInfo" 
					:customerInfo="supplierInfo" 
					:isShowName="isShowName"
					:isShowCp="isShowCp"
					@closeCustmInfo="closeCustmInfo"
					@changeSendGoodsType="changeSendGoodsType"
					@consignVal="consignVal"
					@inputPhone="inputPhone"
					@areaChange="areaChange"
					@inputAddress="inputAddress">
				</purchaseSupplyInfo>
			</view>
			
			<!-- 加购产品 -->
			<view class="c-info" v-show="type == 2 && showInfo">
				<addPurchaseCart ref="addPurchaseCart" 
					:setSellData="setSellData" 
					:limitChangePrice="limitChangePrice"
					@saveCart="saveCart"
					@closeAddRecep="closeAddRecep">
				</addPurchaseCart>
			</view>
		</view>
		<orderDiscountWin ref="orderDiscountWin"></orderDiscountWin>
		<payQrcode ref="payQrcode"></payQrcode>
	</view>
</template>

<script>
	import eventCtrl from "../../js/event/EventCtrl.js";
	
	import purchaseTitle from '../comm/PurchaseTitle.vue';
	
	import purchaseBottomTabbar from "./PurchaseBottomTabbar.vue";
	
	import empty from '../comm/empty.vue';

	import config from "../../js/conf/Config.js";

	import accessCtrl from "../../js/limit/AccessCtrl.js";	
	
	import https from "../../js/https/Https.js";
	
	import cmd from "../../js/Cmd.js";
	
	import util from "../../js/util/Util.js";
	
	import purchaseCart from "./PurchaseCart.vue";
	
	import cartCtrl from "../../js/rereipt/CartCtrl.js";
	
	import addPurchaseCart from "./AddPurchaseCart.vue";
	
	import staticConst from "../../js/const/StaticConst.js";
	
	import orderDiscountWin from "../comm/OrderDiscountWin.vue";
	
	import lang from "../../js/conf/Lang.js";
	
	import purchaseSettlement from "./PurchaseSettlement.vue";
	
	import purchaseSupplyInfo from "./PurchaseSupplyInfo.vue";
	
	import payQrcode from "../comm/PayQrcode.vue";
	
	import localStore from "../../js/LocalStore.js";
	
	import printCtrl from "../../js/print/PrintCtrl.js";
	
	import supplierCtrl from "../../js/supplier/SupplierCtrl.js";
	
	let time = 200;//延时器触发时间
	let printSize = 0;
	export default {
		components : {
					  empty,
					  purchaseTitle,
					  purchaseBottomTabbar,
					  purchaseCart,
					  addPurchaseCart,
					  orderDiscountWin,
					  purchaseSettlement,
					  purchaseSupplyInfo,
					  payQrcode},
		data() {
			return {
				
				seeSupp:false,
				
				orderType:1,//订单类型: 1:销售单，2退货单
				pageTitle : "",
				saleTitle :lang.purchaseCheckOut.title,
				newXsTitTxt : lang.purchaseCheckOut.newXsTitTxt,
				newReturnTitTxt : lang.purchaseCheckOut.newReturnTitTxt,
				returnTitTxt : lang.purchaseCheckOut.returnTitTxt,
				
				switchTipTitTxt : lang.purchaseCheckOut.switchTipTitTxt,
				switchReTipMsgTxt : lang.purchaseCheckOut.switchReTipMsgTxt,
				switchSaleTipMsgTxt : lang.purchaseCheckOut.switchSaleTipMsgTxt,
				
				switchNullTipTxt : lang.purchaseCheckOut.switchNullTipTxt,
				
				tipSelectGdTxt : lang.purchaseCheckOut.tipSelectGdTxt,
				
				switchTxt : "",
				returnTxt : lang.purchaseCheckOut.returnTxt,
				saleTxt : lang.purchaseCheckOut.saleTxt,
				
				supplierInfo : {},
				boxHeight : 211,
				type : 0,//0，隐藏，1供应商，2：产品
				oldType : 0,//保存上次记录
				
				showInfo:false,
				
				setSellData:{},
				
				cartList:[], //购物列表
				
				//底部数量统计
				tabTotal : {
					number : 0, //数量
					totalPrice : 0,//总价
					amountTotle:"",//原价
					discount : 0,//折扣 
					preferential : 0,//优惠
					amountZero : -1,//抹零后价格
					netReceiVal:0,//实际收取金额
					payTypeTxt:"",
					amountOrderPrice : 0,//订单总价（折后/优惠）
					amountFee : 0,//费用
					amountOrPri:0,//保存原始价格
				},
				
				orderAct : -1, //记录单据操作，存草稿用
				
				showSettlement : -1, //-1默认不显示，
				
				ucpList : [], //经手人列表，
				
				emptyHight:uni.getSystemInfoSync().windowHeight - 110,
				
				limitChangePrice : true,//开单是否可以修改价格
				
				limitBillChangeManger : true, //开单经手人是否可改
				
				limitBillChangeTime : true, //开单是否可以改时间
				
				cpid : "",//企业id
				isShowCp:true,//是否显示供应商公司名称
				isShowName:true,//是否显示供应商名称
				isHasYunPrint : true,//是否有云打印
			};
		},
		methods:{
			/***选中开单产品****/
			addGoodsReceipt(data)
			{
				this.isShowCp = supplierCtrl.getIsShowCp(); //customCtrl.getIsShowCp();
				this.isShowName = supplierCtrl.getIsShowName(); //customCtrl.getIsShowName();
				this.emptyHight = uni.getSystemInfoSync().windowHeight - 110;
				this.showInfo = true;
				this.showHideRigthWin();
				this.$refs.purchaseCart.reset();
				this.type = 2;
				this.oldType = 0;
				this.$refs.addPurchaseCart.initGdInfo(data);
			},
			
			/****扫码枪加购产品****/
			scanGunSelectGds(gdInfo)
			{
				let price_quote_type = gdInfo.price_quote_type;
				if(price_quote_type == 0 || gdInfo.specUnit == "")
				{
					let step = Number(util.getInt(this.setSellData.num_step));
					this.$refs.purchaseCart.scanGunSaveCart(gdInfo,step);
				}
				else
				{
					this.addGoodsReceipt(gdInfo);
				}
			},
			
			/***获取供应商信息*****/
			getSuppInfo(data,isCheckOut)
			{
				this.isShowCp = supplierCtrl.getIsShowCp();
				this.isShowName = supplierCtrl.getIsShowName();
				let that = this;
				if(!this.supplierInfo || !this.supplierInfo.id) //没有选择供应商
				{
					this.supplierInfo = data;
					if(!isCheckOut)//不是结账页面
					{   //不是结算,
						this.$refs.addPurchaseCart.setCustom(this.supplierInfo.id);
					}
					// else
					// {
						//结帐页面
					this.$refs.purchaseCart.changCustomer(this.supplierInfo.id);
					// }
					return;
				}
				
				if(this.supplierInfo.id != data.id)
				{
					if(this.cartList && that.cartList.length > 0)
					{
						let obj = {};
						obj.content = "你当前开单是供应商:" + this.supplierInfo.name + ",是否要跟换成供应商:" + data.name; 
						obj.showCancel = true;
						lang.showWin(obj,back);
					}
					else
					{
						this.supplierInfo = data;
						this.$refs.addPurchaseCart.setCustom(this.supplierInfo.id);
					}
				}
				else
				{
					this.supplierInfo = data;
					this.$refs.purchaseCart.changCustomer(this.supplierInfo.id);
				}
				
				function back(res)
				{
					if(res && res.confirm)
					{
						that.supplierInfo = data;
						that.$refs.purchaseCart.changCustomer(that.supplierInfo.id);
					}
				}
			},
			
			/****展示用户更多信息****/
			showSuppInfo()
			{
				if(this.showInfo)
				{
					if(this.type == 2)
					{
						this.oldType = this.type;
						this.type = 1;
					}
					else
					{
						if(this.oldType == 2)
						{
							this.type = this.oldType;
						}
						else
						{
							this.type = 0;
							this.showInfo = false;
							this.showHideRigthWin();
						}
					}
				}
				else
				{
					this.type = 1;
					this.showInfo = true;
					this.showHideRigthWin();
				}
			},
			
			/****获取是否有云打印列表******/
			 getYunPrintList()
			 {
				let that = this;
				let param = {};
				https.getPrintYunList(param,back)
				function back(data)
				{
					if(!data)return;
					console.log("data===",data);
					if(data.status == 1)
					{
						if(!data.data)return;
						data = data;
						if(data.ls && data.ls.length > 0)
						{
							that.isHasYunPrint = true;
						}
					}
				}
			 },
			
			/****关闭用户信息***/
			closeCustmInfo()
			{
				if(this.oldType == 2)
				{
					this.type = this.oldType;
				}
				else
				{
					this.showInfo = false;
					this.type = 0;
					this.showHideRigthWin();
				}
			},
			
			/***返回购物车****/
			backCart()
			{
				this.showSettlement = -1;
				// this.boxHeight = 170;
				this.$emit("checkOut",false);
				this.setDjTitle();
			},
			
			
			/***点击添加供应商****/
			addSupp()
			{
				this.$emit("addSupp");
			},
			
			/****选择开单产品*****/
			emptyAct(act)
			{
				if(act == 1)
				{
					this.$emit("selectSuppBillGoods");
				}
			},
			
			async initData()
			{
				this.seeSupp = await accessCtrl.getPurchViewSupplierLimit();
				this.boxHeight = this.seeSupp ? 211 : 108;
				let cp = await localStore.getCpInfo();
				this.cpid =  cp.id;
				this.getPrintSize(this.cpid);
				this.limitChangePrice = await accessCtrl.getPurchEditPriceLimit();//开单是否可以修改价格
				this.limitBillChangeManger = await accessCtrl.getPurchEditMangerLimit(); //开单经手人是否可改
				this.limitBillChangeTime = await accessCtrl.getPurchEditTimeLimit(); //开单是否可以改时间
				this.clearData();
				await this.getSettingSell();
				await this.getCartInfo();
				await this.loadUcpList();
				await this.getYunPrintList();
				
				//判断是否有开单供应商
				let tempCInfo = supplierCtrl.getBillSupp(); //customCtrl.getBillCustom();
				if(tempCInfo)
				{
					let data = JSON.parse(JSON.stringify(tempCInfo));
					this.getSuppInfo(data);
					tempCInfo = null;
					supplierCtrl.setBillSupp(null);
				}
			},
			
			/*****经手人列表*****/
			async loadUcpList()
			{
				let that = this;
				this.ucpList = [];
				https.loadUcpList(back);
				function back(data)
				{
					if(!data)return;
					let len = data.length;
					for(let i = 0; i < len; i++)
					{
						let obj = data[i];
						let temp = {};
						temp.id = obj.uid;
						temp.title = obj.name;
						that.ucpList.push(temp);
					}
				}
			},
			
			/***销售配置***/
			getSettingSell()
			{
				let that = this;
				let param = {};
				https.cgSettingSell(param,back);
				function back(data)
				{
					if(!data)return;
					if(data.status == 1)
					{
						if(!data.data)return;
						data = data.data;
						that.setSellData.is2amount = data.is2amount;//"默认收款为应收，1是2否	
						that.setSellData.is_fee = data.is_fee;//开单是否打开费用，1是2否
						that.setSellData.is_seller = data.is_seller; //显示经手人，1是2否
						that.setSellData.is_txt = data.is_txt;//显示单据备注，1是2否
						that.setSellData.is_zk_sku = data.is_zk_sku;//开单是否显示折扣-sku，1是2否
						that.setSellData.isscan_act = data.isscan_act;//扫码时动作，开单时扫码时动作，1直接开单；2去加购
						that.setSellData.isscan_num_step = data.isscan_num_step;//扫码加购时按下单数量加减步长，1是2否
						that.setSellData.money_p = data.money_p;//价格小数位
						that.setSellData.num_min = util.getInt(data.num_min) ;//产品起订量，对于每个sku
						that.setSellData.num_p = Number(data.num_p);//数量小数位
						that.setSellData.num_step = util.getInt(data.num_step);//下单数量加减步长，不支持多规格多条码
					}
				}
			},
			
			/***底部按钮操作***/
			optionAct(act)
			{
				if(act == staticConst.RECEIPT_DEL_ACT) //清除购物车
				{
					this.removeCartInfo();
				}
				else if(act == staticConst.RECEIPT_DISC_ACT 
					|| act == staticConst.RECEIPT_ZERO_ACT)//折扣，抹零
				{
					if(!this.limitChangePrice)
					{
						this.$msg({title:lang.purchaseCheckOut.noChangePriceTip})
						return;
					}
					
					this.orderAct = act;
					let wType = 2;
					this.$refs.orderDiscountWin.show("show",act,this.tabTotal,wType);
				}
				else if(act == staticConst.RECEIPT_DERIFT_ACT) //草稿
				{
					this.isSureSaveDerift();
				}
				else if(act == staticConst.RECEIPT_SETTLEMENT_ACT)//结算
				{
					if(this.showSettlement == -1)
						this.orderCheckOut();
					else
						this.$refs.settlement.finishOrder();
				}
			},
			
			/*****清理数据*****/
			clearData()
			{
				this.supplierInfo = null;
				this.cartList = [];
				this.tabTotal = {
					number : 0, //数量
					totalPrice : 0,//总价
					amountTotle:"",//原价
					discount : 0,//折扣 
					preferential : 0,//优惠
					amountZero : -1,//抹零后价格
					netReceiVal:0,//实际收取金额
					payTypeTxt:"",
					amountOrderPrice : 0,//订单总价（折后/优惠 + 费用）
					amountOrPri:0,//保存原始价格
				};
				this.$refs.addPurchaseCart.setCustomerIdNull();
				// this.$refs.purchSuppInfo.clearData();
			},
			
			//放弃开单
			removeCartInfo()
			{
				let that = this;
				let data = {};
				data.title = lang.receiptAct.removeOrderTit;
				data.content = lang.receiptAct.removeOrderTxt;
				data.showCancel = true;
				lang.showWin(data,callBack);
				function callBack(res)
				{
					if(res.confirm)
					{
						that.$refs.settlement.retData();
						that.showSettlement = -1;
						that.$emit("setGdSuppIdNull"); 
						// that.boxHeight = 170;
						that.$emit("checkOut",false);
						that.clearData();
						that.$refs.purchaseCart.saveCart(null,1);
						that.setDjTitle();
					}
				}
			},
			
			/****提示是否存草稿单***/
			isSureSaveDerift()
			{
				let that = this;
				let data = {};
				data.title = lang.receiptAct.deriftOrdTit;
				data.content = lang.receiptAct.deriftOrdTxt;
				data.showCancel = true;
				lang.showWin(data,callBack);
				function callBack(res)
				{
					if(res.confirm)
					{
						if(that.showSettlement == -1)
							that.saveDerift();
						else
							that.saveCheckOutDerift();
						that.setDjTitle();
					}
				}
			},
			
			/****存草稿单***/
			saveDerift()
			{
				let that = this;
				let param = {};
				param.backup = 1;
				param.amount = this.tabTotal.totalPrice;
				if(this.orderAct == staticConst.RECEIPT_ZERO_ACT)//抹零操作 
				{
					param.discount_r = -1;
					param.amount_zero = this.tabTotal.amountZero;
				}
				else //折扣，没有折扣，抹零操作
				{
					param.discount_r = this.tabTotal.discount;
					param.amount_zero = -1;
				}
				param.amount_od = this.tabTotal.amountOrderPrice;
				https.cgOrderAdd(param,back);
				function back(data)
				{
					if(!data)return;
					if(data.status == 1)
					{
						that.clearData()
						that.$msg({title:data.msg,callback:callBack});
					}
				}
				
				function callBack()
				{
					that.saveCart();
				}
			},
			
			/***结帐页面存草稿***/
			saveCheckOutDerift()
			{
				this.$refs.settlement.finishOrder(1); //存草稿
			},
			
			/***加购成功***/
			saveCart()
			{
				if(this.showSettlement == -1)
				{
					//购物车页面
					this.closeAddRecep();
					this.getCartInfo();
				}
				else
				{
					//结账页面，
					this.orderCheckOut();
				}
				this.setDjTitle();
			},
			
			/****检查是否有下架产品*****/
			checkNotSale()
			{
				let len = this.cartList.length;
				for(let i = 0; i<len; i++)
				{
					let obj = this.cartList[i];
					if(obj.onsale != 1)return false;
				}
				return true;
			},
			
			/***购物信息****/
			getCartInfo()
			{
				let that = this;
				this.orderType = 1;
				let param = {};
				this.cartList = [];
				https.cgCartInfo(param,back);
				function back(data)
				{
					if(!data)return;
					if(data.status == 1)
					{
						if(!data.data)return;
						data = data.data;
						if(data.cg_supp)
							that.supplierInfo = data.cg_supp;
						if(data.hasOwnProperty('type'))
						{
							if(data.type == 0)
							{
								that.orderType = 1; //默认开销售单
							}
							else
							{
								that.orderType = data.type;
							}
						}
						if(data.gd_ls)
						{
							that.cartList = cartCtrl.cartInfoHandler(data.gd_ls,that.setSellData);
						}
						if(data.num_totle)
							that.tabTotal.number = util.getInt(data.num_totle);
						if(data.amount)
							that.tabTotal.totalPrice = data.amount;
							
						if(data.amount_od)
						{
						   that.tabTotal.amountOrderPrice = data.amount_od;
						   that.tabTotal.amountOrPri = data.amount_od;
						}
						   
						if(data.amount_p)
							that.tabTotal.amountTotle = data.amount_p;
						if(data.discount_r)
							that.tabTotal.discount = util.getInt(data.discount_r);
						if(data.discount)
							that.tabTotal.preferential = util.getInt(data.discount);
						that.orderAct = data.countype;
						that.setDjTitle();
					}
				}
			},
			
			setDjTitle()
			{
				if(this.orderType == 1)
				{
					if(this.showSettlement == -1)
					{
						this.pageTitle = this.newXsTitTxt;
						this.switchTxt = this.returnTxt;
					}
					else
						this.pageTitle = this.saleTitle;
				}
				else
				{
					if(this.showSettlement == -1)
					{
						this.pageTitle = this.newReturnTitTxt;
						this.switchTxt = this.saleTxt;
					}
					else
						this.pageTitle = this.returnTitTxt;
				}
			},
			
			/***切换开单类型*****/
			swichTypeHandler()
			{
				if((!this.supplierInfo || !this.supplierInfo.id) && this.cartList && this.cartList.length == 0)
				{
					let msg = this.switchNullTipTxt;
					if(!this.seeSupp)
						msg = this.tipSelectGdTxt; 
					this.$msg({title:msg});
					return;
				}
				let that = this;
				let msg = this.orderType == 1 ? this.switchReTipMsgTxt : this.switchSaleTipMsgTxt;
				let data = {};
				data.title = this.switchTipTitTxt;
				data.content = msg;
				data.showCancel = true;
				lang.showWin(data,back);
				function back(res)
				{
					if(res.confirm)
					{
						let type = that.orderType == 1 ? 2 : 1;
						that.$refs.purchaseCart.saveCart(null,null,type);
					}
				}
			},
			
			/****编辑产品****/
			editCartInfo(item)
			{
				this.$emit("editCart");
				if(!item || !item.gdid)return;
				let that = this;
				let url = config.GD_INFO;
				let param = {};
				param.goods_id = item.gdid;
				
				https.loadGoodsInfo(param,back);
				function back(data)
				{
					if(!data)return;
					that.showInfo = true;
					that.showHideRigthWin();
					let obj = {};
					if(data.goodsInfo.imgs && data.goodsInfo.imgs_s)
						data.goodsInfo.imgs = data.goodsInfo.imgs_s[0];
					obj.gdInfo = data.goodsInfo;
					obj.cartInfo = item;
					that.$refs.addPurchaseCart.editCart(obj);
					that.type = 2;
					that.oldType = 0;
				}
			},
			
			/****关闭加购***/
			closeAddRecep()
			{
				this.showInfo = false;
				this.showHideRigthWin();
				this.type = 0;
				this.$emit("editCart"); //取消产品列表选中状态
				this.$refs.purchaseCart.reset();//
			},
			
			/***开单-去结账***/
			orderCheckOut()
			{
				let that = this;
				if(this.checkNotSale())
				{
					orderCheckout();
				}
				else
				{
					if(this.checkNotSale())
					{
						orderCheckout();
					}
					else
					{
						//提示有下架产品，
						let data = {}; 
						data.content = lang.notSaleGdCheckOutTip;
						data.showCancel = true;
						data.confirm = lang.jsTxt;
						lang.showWin(data,back);
					}
				}
				
				function back(res)
				{
					if(res.confirm)
					{
						orderCheckout();
					}
				}
				
				function orderCheckout()
				{
					https.cgOrderCheckout({},orderCheckoutBack);
				}
				
				function orderCheckoutBack(data)
				{
					
					if(!data)return;
					if(data.status == 1)
					{
						if(!data.data)return;
						that.closeAddRecep();
						data = data.data;
						that.showSettlement = 1;
						// that.boxHeight = 215;
						if(that.setSellData.is2amount == 1)
							that.tabTotal.netReceiVal = that.tabTotal.amountOrderPrice;
						that.$emit("checkOut",true);
						
						that.$refs.purchSuppInfo.initData(data);
						
						that.$refs.settlement.initData(that.tabTotal,data,that.ucpList);
						that.setDjTitle();
					}
				}
			},
			
			/****结帐完成****/
			finishOrderBack(data)
			{
				if(data && data.isLocalPrint)
				{
					this.print(data.odid);
				}
				this.$emit("setGdSuppIdNull"); 
				this.clearData();
				this.showSettlement = -1;
				// this.boxHeight = 170;
				this.showInfo = false;
				this.type = 0;
				this.oldType = 0;
				this.showHideRigthWin();
				this.$emit("checkOut",false);
				this.setDjTitle();
				this.$refs.purchSuppInfo.initData();
				if(data)
				{
					if(data.isOnlinePay)
					{
						//线上二维码支付
						data.objtype = staticConst.PAY_OBJ_01;
						this.$refs.payQrcode.creatQrcode(data);
					}
				}
			},
			
			/***获取企业打印模板尺寸***/
			getPrintSize(cpid)
			{
				printSize = printCtrl.printSize;
				// alert(printSize);
				if(printSize == 0) //==0重新请求
				{
					printCtrl.getPrintSize(cpid,back);
				}
				function back(data)
				{
					printSize = data;
				}
			},
			
			/****本地打印****/
			print(orderId)
			{
				if(orderId)
				{
					let data = {};
					data.cpid = this.cpid;
					data.orderId = orderId;
					data.type = staticConst.ORDER_CG;
					data.type_od = this.orderType;
					if(printSize == staticConst.PRINT_SIZE_241) //241模板
					{
						data.url = config.PRINT_URL_1;
					}
					else if(printSize == staticConst.PRINT_SIZE_80)//80模板
					{
						data.url = config.PRINT_URL_2;
					}
					printCtrl.print(data);
					this.printCount(orderId);
				}
			},
			
			/***打印次数累计***/
			printCount(orderId)
			{
				let that = this;
				let param = {};
				param.cpid = this.cpid;
				param.type = staticConst.ORDER_CG;
				param.odtype = this.orderType;
				param.odid = orderId;
				https.printCount(param);
			},
			
			/****改变发货方式***/
			changeSendGoodsType(data)
			{
				this.$refs.settlement.changeSendGoodsType(data);
			},
			
			/***输入收货人****/
			consignVal(e)
			{
				this.$refs.settlement.consignVal(e);
			},
			
			/****输入电话号码***/
			inputPhone(e)
			{
				this.$refs.settlement.inputPhone(e);
			},
			
			/***选择地区****/
			areaChange(province,city,area)
			{
				this.$refs.settlement.areaChange(province,city,area);
			},
			
			/****输入地址***/
			inputAddress(e)
			{
				this.$refs.settlement.inputAddress(e);
			},
			
			/***关闭右侧窗口**/
			showHideRigthWin()
			{
				cmd.external(cmd.CMD_SHOW_MORE,this.showInfo);
			},
			
			getBoxHeight()
			{
				this.emptyHight = uni.getSystemInfoSync().windowHeight - 110;
			},
			
			addEvent()
			{
				uni.$on(eventCtrl.CHANGE_SIZE_EVENT,this.getBoxHeight);
			},
			
			removeEvent()
			{
				uni.$off(eventCtrl.CHANGE_SIZE_EVENT);
			},
		},
		mounted() {
			this.addEvent();
		},
	}
</script>
<style lang="scss">
	.receipt-info
	{
		flex: 1;
		margin-left: 345px;
		height: 100vh;
		background-color: #FFF;
		// border-right: #ECECEC 1px solid;
		.overflow-box
		{
			overflow-y:auto;
			z-index: 9999;
			// height: calc(100vh - 171px);
			button
			{
				margin: 10px 0;
				background: #007AFF;
				color: #FFF;
				font-size: 20px;
			}
		}
		.overflow-box::-webkit-scrollbar {/*滚动条整体样式*/
		    width: 4px;     /*高宽分别对应横竖滚动条的尺寸*/
		    height: 0px;
		}
		.overflow-box::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
			border-radius: 10px;
			-webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
			background: #ccc;//rgba(0, 0, 0, 0.0);
			scrollbar-arrow-color: red;
		}
		.overflow-box::-webkit-scrollbar-track {/*滚动条里面轨道*/
			-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0);
			border-radius: 0;
			background: rgba(0,0,0,0);
		}
		
		.bttom-btn-box
		{
			width: 100%;
			position: fiexd;
			bottom: 0;
		}
		
		.info-content
		{
			display: flex;
			// align-items: center;
			// justify-content: flex-start;
		}
		.b-info
		{
			// padding-right: 310px;
			// margin-right: 310px;
			width: 100%;
			height: 100%;
			border-right: 1px solid #ECECEC;
			background: #fff;
			.empty-p-style
			{
				// padding-top: 110px;
				// height: 800px ;
			}
		}
		
		.c-info
		{
			width: 310px;
			height: 100%;
		}
	}
</style>